import { ArrayMinSize, IsInt, IsNotEmpty, ValidateIf } from 'class-validator'
import { IsEmailFormat } from 'src/admin/validator/validate.admin'
export class CreateSupplierDto {
    id: number
    @IsNotEmpty({message: '供应商名称不能为空'})
    name: string
    @IsInt({ each: true })
    @ArrayMinSize(1, {message: '至少一个分类'})
    categoryIds?: number[];
    code: string
    @IsNotEmpty({message: '联系人不能为空'})
    contacts: string
    @IsNotEmpty({message: '联系电话不能为空'})
    mobile: string
    @ValidateIf(r => r.email)
    //@IsNotEmpty({message: '邮箱不能为空'})
    @IsEmailFormat()
    email: string
    //@IsNotEmpty({message: '地址不能为空'})
    address: string
    payType: number
    //@IsNotEmpty({message: '统一社会信用代码不能为空'})
    creditCode: string
    //@IsNotEmpty({message: '纳税人识别号不能为空'})
    tin: string
    bank: string
    account: string
    bankNo: string
    remark: string
}
